How can i use Stopwatch [ apache ] to calculate the time taken by a method?
Posted
by Rakesh Juyal
on Stack Overflow
See other posts from Stack Overflow
or by Rakesh Juyal
Published on 2010-06-16T11:08:26Z
Indexed on
2010/06/16
11:12 UTC
Read the original article
Hit count: 305
I am using StopWatch [ apache ] to get the time taken by my method. The approach i am following is
StopWatch stopWatch = new StopWatch();
stopWatch.start();
myMethod();
stopWatch.stop();
logger.info( "Time taken by myMethod: " + stopWatch.getTime() + " millisecs");
stopWatch.reset();
stopWatch.start();
anotherMethod();
stopWatch.stop();
logger.info( "Time taken by anotherMethod: " + stopWatch.getTime() + " millisecs");
Thats the only thing i know about StopWatch :).
How/when to use split(), unsplit(), getSplitTime(),suspend()... ?
© Stack Overflow or respective owner